#ifndef __FILE_POINTER_H__
#define __FILE_POINTER_H__

#include <iostream>
#include <cstring>

class FilePointer{
	public:		
		FilePointer(){}
		virtual ~FilePointer(){}

		virtual unsigned char getType()const =0;
		virtual FilePointer* duplicate()const = 0;

		virtual char* toBytes(char* data)const{
			char* temp = data;
			unsigned char type = this->getType();
			memcpy(temp,&type,sizeof(unsigned char));
			temp+=sizeof(unsigned char);
			return temp;
		}

		virtual void operator =(const FilePointer& pointer) = 0;
		virtual unsigned int getSize()const{
			return sizeof(unsigned char);
		}
		virtual std::ostream& toOstream(std::ostream& out)const = 0;

		virtual char* toFilePointer(char* data){
			/* El tipo no se almacena asi que solo se saltea el byte */
			char* temp = data;
			temp+=sizeof(unsigned char);
			return temp;
		}

		static unsigned char peekType(char* data){
			return (*(unsigned char*)(data));
		}
};


#endif /* __FILE_POINTER_H__ */
